<template>
  <div>
    <SellDog
      v-for="(item, index) in arr"
      :key="index"
      :dogName="item.dogName"
      :dogImgUrl="item.dogImgUrl"
      @like="fn"
    ></SellDog>

    <p>显示喜欢的狗:</p>
    <ul>
      <li  v-for="(item, index) in newArr" :key="index">
        {{ item }}
      </li>
    </ul>
  </div>
</template>

<script>
import SellDog from "./components/SellDog.vue";
export default {
  components: {
    SellDog,
  },
  data() {
    return {
      arr: [
        {
          dogImgUrl:
            "https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimg.mp.itc.cn%2Fupload%2F20161030%2F0bf4745fadf046b3a68ece0763fc3010_th.jpeg&refer=http%3A%2F%2Fimg.mp.itc.cn&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1666440045&t=9dfec519d1b53f62087e4eedb0639de4",
          dogName: "博美",
        },
        {
          dogImgUrl:
            "https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimg.mp.itc.cn%2Fupload%2F20161030%2F0bf4745fadf046b3a68ece0763fc3010_th.jpeg&refer=http%3A%2F%2Fimg.mp.itc.cn&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1666440045&t=9dfec519d1b53f62087e4eedb0639de4",
          dogName: "泰迪",
        },
        {
          dogImgUrl:
            "https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimg.mp.itc.cn%2Fupload%2F20161030%2F0bf4745fadf046b3a68ece0763fc3010_th.jpeg&refer=http%3A%2F%2Fimg.mp.itc.cn&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1666440045&t=9dfec519d1b53f62087e4eedb0639de4",
          dogName: "金毛",
        },
        {
          dogImgUrl:
            "https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimg.mp.itc.cn%2Fupload%2F20161030%2F0bf4745fadf046b3a68ece0763fc3010_th.jpeg&refer=http%3A%2F%2Fimg.mp.itc.cn&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1666440045&t=9dfec519d1b53f62087e4eedb0639de4",
          dogName: "哈士奇",
        },
        {
          dogImgUrl:
            "https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimg.mp.itc.cn%2Fupload%2F20161030%2F0bf4745fadf046b3a68ece0763fc3010_th.jpeg&refer=http%3A%2F%2Fimg.mp.itc.cn&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1666440045&t=9dfec519d1b53f62087e4eedb0639de4",
          dogName: "阿拉斯加",
        },
        {
          dogImgUrl:
            "https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimg.mp.itc.cn%2Fupload%2F20161030%2F0bf4745fadf046b3a68ece0763fc3010_th.jpeg&refer=http%3A%2F%2Fimg.mp.itc.cn&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1666440045&t=9dfec519d1b53f62087e4eedb0639de4",
          dogName: "萨摩耶",
        },
      ],
      newArr: [],
    };
  },
  methods: {
    fn(dogName) {
      this.newArr.push(dogName);
    },
  },
};
</script>

<style>


</style>